#!/usr/bin/env python3

import os.path
import subprocess
import sys

rustc = os.path.expanduser("~/.cargo/bin/rustc")

args = []
sys.argv.pop(0)
for arg in sys.argv:
    if arg == "cdylib":
        arg = "staticlib"
        args.append(arg)
        args += ["--target", "aarch64-apple-ios"]
    else:
        args.append(arg)

#try:
#    args.remove("--crate-type")
#    args.remove("lib")
#except ValueError:
#    pass

cmd = [rustc]+args
print(cmd, file=sys.stderr)

subprocess.run(cmd, stdout=sys.stdout, stderr=sys.stderr)

sys.exit(0)
